package com.example.controller;


import com.example.common.utils.R;
import com.example.system.service.IChatRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 王鹤蒲
 * @since 2024-02-28
 */
@RestController
@Api(tags = "聊天记录API",description="提供聊天记录相关的 REST API")
@RequestMapping("/chat-record")
public class ChatRecordController {

    @Autowired
    private IChatRecordService iChatRecordService;


    @ApiOperation(value = "", notes = "")
    @RequestMapping(value="/findByUserName",method = RequestMethod.GET)
    @ResponseBody
    public R findByUserName(@RequestParam String sender,@RequestParam String receiver){
        return iChatRecordService.findByUserName(sender,receiver);
    }

    @ApiOperation(value = "", notes = "")
    @RequestMapping(value="/findUnreadNums/{receiver}",method = RequestMethod.GET)
    @ResponseBody
    public R findUnreadNums(@PathVariable("receiver") String receiver){
        return iChatRecordService.findUnreadNums(receiver);
    }


    @ApiOperation(value = "", notes = "")
    @RequestMapping(value="/selectOnlineInquiryPatientList/{sender}",method = RequestMethod.GET)
    @ResponseBody
    public R selectOnlineInquiryPatientList(@PathVariable("sender") String sender) {
        return iChatRecordService.selectOnlineInquiryPatientList(sender);
    }

}

